/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-11-29
 * Time: 21:51
 */
class Solution2 {
    public int findPoisonedDuration(int[] nums, int time) {
        int sum = 0;
        for(int i = 0 ; i < nums.length-1 ; i++){
            if(nums[i+1] - nums[i] >= time){
                sum += time;
            }else{
                sum += nums[i+1]-nums[i];
            }
        }
        sum += time;
        return sum;
    }
}
public class Test2 {
}
